package com.jf3q.common.es.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Document(indexName = "course")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseEntity implements Serializable {
    @Id
    private String id;
    private String cover;//课程封面

    /*
    * analyzer：定义索引时使用的分析器。
    * searchAnalyzer：定义搜索时使用的分析器。
    * */
    @Field(type = FieldType.Text, analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String title;//课程标题
    private BigDecimal price;//课程价格
    private String subjectParentId; //课程一级分类id
    @Field(type = FieldType.Text, analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String subjectParentName; //课程一级分类名称
    private String subjectId;//课程二级分类id
    @Field(type = FieldType.Text, analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String subjectName;//课程二级分类名称
    @Field(type = FieldType.Date)
    private Date eduCreate;//添加时间
    private Long buyCount;//销量
    private Long viewCount;//课程浏览量（不是视频播放量）
    @Field(type = FieldType.Text, analyzer = "ik_max_word",searchAnalyzer = "ik_smart")
    private String description;//课程介绍


}


